import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { alarmrecordVO, alarmrecordForm, alarmrecordQuery } from '@/api/workbench/alarm/alarm-record/types';

/**
 * 查询告警记录列表
 * @param query
 * @returns {*}
 */

export const listalarmrecord = (query?: alarmrecordQuery): AxiosPromise<alarmrecordVO[]> => {
  return request({
    url: '/alarm/alarmRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询告警记录详细
 * @param alarmRecordId
 */
export const getalarmrecord = (alarmRecordId: string | number): AxiosPromise<alarmrecordVO> => {
  return request({
    url: '/alarm/alarmRecord/' + alarmRecordId,
    method: 'get'
  });
};

/**
 * 新增告警记录
 * @param data
 */
export const addalarmrecord = (data: alarmrecordForm) => {
  return request({
    url: '/alarm/alarmRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改告警记录
 * @param data
 */
export const updatealarmrecord = (data: alarmrecordForm) => {
  return request({
    url: '/alarm/alarmRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除告警记录
 * @param alarmRecordId
 */
export const delalarmrecord = (alarmRecordId: string | number | Array<string | number>) => {
  return request({
    url: '/alarm/alarmRecord/' + alarmRecordId,
    method: 'delete'
  });
};

/**获取告警记录详细信息安防地图* */
export const alarmRecordDetail = (alarmRecordId: string | number): AxiosPromise<alarmrecordVO> => {
  return request({
    url: '/alarm/alarmRecord/alarmRecordDetail/' + alarmRecordId,
    method: 'get'
  });
};
export const editalarmRecordHandleStatus = (data: alarmrecordForm) => {
  return request({
    url: '/alarm/alarmRecord/editalarmRecordHandleStatus',
    method: 'post',
    data: data
  });
};

export const distributeWorkOrders = (data) => {
  return request({
    url: '/alarm/alarmRecord/insertWorkOrderByAlarmUser',
    data: data,
    method: 'post'
  });
};
